package cn.design.realize.objectadapter.Impl;

import cn.design.realize.objectadapter.AmericanVoltage110V;
import cn.design.realize.objectadapter.JapanVoltage100V;

/**
 * @author dlq
 * @description 这里有一个电压适配器，传入是中国的电压
 * @date 2020/9/16 11:19
 * @since 1.0
 */
public class VoltageAdapter {
    private AmericanVoltage110V americanVoltage110V;

    private JapanVoltage100V japanVoltage100V;

    public  VoltageAdapter(){
        this.americanVoltage110V = new AmericanVoltage110VImpl();
        this.japanVoltage100V = new JapanVoltage100VImpl();
    }

    /**
     * 方法：美国电压转换110V
     */
    public void  americanVoltage(Integer voltage){
        int i = voltage/22*11;
        americanVoltage110V.americanVoltagePowerOn(i);
    }
    /**
     * 方法：日本电压转化100V
     */
    public void  japanVoltage(Integer voltage){
        int i = voltage/22*10;
        japanVoltage100V.japanPowerOn(i);
    }
}
